package cn.dxh.stagefinal.service.impl;

import cn.dxh.stagefinal.bean.Sendback;
import cn.dxh.stagefinal.dao.SendbackDao;
import cn.dxh.stagefinal.service.SendbackService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class SendbackServiceImpl implements SendbackService {

    @Autowired
    private SendbackDao sendbackDao;

    @Override
    public PageInfo<Sendback> findBacks(Integer pageindex, Integer size, String
            backnum, String source, String backdate, String username, Integer backstate) {
        PageHelper.startPage(pageindex,size);
        Map map = new HashMap();
        map.put("backnum",backnum);
        map.put("source",source);
        map.put("backdate",backdate);
        map.put("username",username);
        map.put("backstate",backstate);
        List<Sendback> orderList = sendbackDao.findbacks(map);
        PageInfo<Sendback> pageInfo = new PageInfo<>(orderList);
        return pageInfo;
    }

    @Override
    public Sendback getOne(Integer backid) {
        return sendbackDao.getOne(backid);
    }
}
